{
 "cells": [
  {
   "cell_type": "code",
   "execution_count": 5,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "'HELLO'"
      ]
     },
     "execution_count": 5,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "s = 'hello'\n",
    "s.upper()"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 8,
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "hi\n"
     ]
    }
   ],
   "source": [
    "set1 = set()\n",
    "print('hi')"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 6,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "('hello',)"
      ]
     },
     "execution_count": 6,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "import timeit\n",
    "timeit\n",
    "singleton = 'hello',\n",
    "singleton"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 8,
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "<class 'set'>\n",
      "{'banana', 'apple', 'orange', 'pear'}\n"
     ]
    }
   ],
   "source": [
    "basket = {'apple', 'orange', 'apple', 'pear', 'orange', 'banana'}\n",
    "print(type(basket))\n",
    "print(basket)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 15,
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "{' ', 't', 's', 'i', 'h', 'o', 'e', 'n', 'm', 'g'}\n"
     ]
    }
   ],
   "source": [
    "chars = {c for c in 'this is something'}\n",
    "print(chars)\n"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 57,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "True"
      ]
     },
     "execution_count": 57,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "s = 'A man, a plan, a canal: Panama'\n"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 66,
   "metadata": {},
   "outputs": [
    {
     "ename": "SyntaxError",
     "evalue": "'return' outside function (<ipython-input-66-1b6f9701ea18>, line 7)",
     "output_type": "error",
     "traceback": [
      "\u001b[0;36m  File \u001b[0;32m\"<ipython-input-66-1b6f9701ea18>\"\u001b[0;36m, line \u001b[0;32m7\u001b[0m\n\u001b[0;31m    return False\u001b[0m\n\u001b[0m    ^\u001b[0m\n\u001b[0;31mSyntaxError\u001b[0m\u001b[0;31m:\u001b[0m 'return' outside function\n"
     ]
    }
   ],
   "source": [
    "s='ab'\n",
    "s=s.casefold()\n",
    "chars = list(filter(lambda c:c.isalpha(), s))\n",
    "low, high=0, len(chars)-1\n",
    "while(low<high):\n",
    "    if chars[low] != chars[high]:\n",
    "        return False\n",
    "return True"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 109,
   "metadata": {},
   "outputs": [],
   "source": [
    "s='aba'\n",
    "s='bbc'"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 110,
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "bbc\n"
     ]
    },
    {
     "data": {
      "text/plain": [
       "False"
      ]
     },
     "execution_count": 110,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "print(s)\n",
    "s = ''.join(filter(lambda c: c.isalnum(), s)).lower()\n",
    "m = int(len(s)/2)\n",
    "right=m\n",
    "left=m+m%2\n",
    "left,right=s[:left], s[right:]\n",
    "left == ''.join(reversed(right))"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": [
    ">>> a_string = 'amanaplanacanalpanama' * 10\n",
    ">>> min(timeit.repeat(lambda: reverse_string_readable_answer(a_string)))\n",
    "10.38789987564087\n",
    ">>> min(timeit.repeat(lambda: reversed_string(a_string)))\n",
    "0.6622700691223145\n",
    ">>> min(timeit.repeat(lambda: reverse_a_string_slowly(a_string)))\n",
    "25.756799936294556\n",
    ">>> min(timeit.repeat(lambda: reverse_a_string_more_slowly(a_string)))\n",
    "38.73570013046265"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 23,
   "metadata": {},
   "outputs": [],
   "source": [
    "s = 'amanaplanacanalpanama'"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 24,
   "metadata": {},
   "outputs": [],
   "source": [
    "\n",
    "def reverse_simple(s):\n",
    "    return s[::-1]\n",
    "def reverse_readable(s):\n",
    "    return ''.join(reversed(s))"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 32,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "0.00010040099732577801"
      ]
     },
     "execution_count": 32,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "import timeit\n",
    "\n"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 44,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "0.9958420610055327"
      ]
     },
     "execution_count": 44,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": []
  },
  {
   "cell_type": "code",
   "execution_count": 48,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "1.6800561340060085"
      ]
     },
     "execution_count": 48,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "timeit.timeit('\"amanaplanacanalpanama\"[::-1]', number=10000000)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 49,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "9.636620013043284"
      ]
     },
     "execution_count": 49,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "timeit.timeit('\"\".join(reversed(\"amanaplanacanalpanama\"))', number=10000000)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 1,
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "/Users/bin/Documents/Workspace/GitHub/Python-for-Algorithm-and-Interviews\r\n"
     ]
    }
   ],
   "source": [
    "!pwd"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 2,
   "metadata": {},
   "outputs": [],
   "source": [
    "!say 'hi'"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 6,
   "metadata": {},
   "outputs": [
    {
     "ename": "ValueError",
     "evalue": "stmt is neither a string nor callable",
     "output_type": "error",
     "traceback": [
      "\u001b[0;31m---------------------------------------------------------------------------\u001b[0m",
      "\u001b[0;31mValueError\u001b[0m                                Traceback (most recent call last)",
      "\u001b[0;32m<ipython-input-6-f4faed179849>\u001b[0m in \u001b[0;36m<module>\u001b[0;34m()\u001b[0m\n\u001b[0;32m----> 1\u001b[0;31m \u001b[0mtimeit\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0mtimeit\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0;34m[\u001b[0m\u001b[0;36m2\u001b[0m \u001b[0;34m*\u001b[0m \u001b[0mn\u001b[0m \u001b[0;32mfor\u001b[0m \u001b[0mn\u001b[0m \u001b[0;32min\u001b[0m \u001b[0mrange\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0;36m1000\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m]\u001b[0m\u001b[0;34m,\u001b[0m\u001b[0mnumber\u001b[0m\u001b[0;34m=\u001b[0m\u001b[0;36m1000\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0m",
      "\u001b[0;32m/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/timeit.py\u001b[0m in \u001b[0;36mtimeit\u001b[0;34m(stmt, setup, timer, number, globals)\u001b[0m\n\u001b[1;32m    231\u001b[0m            number=default_number, globals=None):\n\u001b[1;32m    232\u001b[0m     \u001b[0;34m\"\"\"Convenience function to create Timer object and call timeit method.\"\"\"\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0;32m--> 233\u001b[0;31m     \u001b[0;32mreturn\u001b[0m \u001b[0mTimer\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0mstmt\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0msetup\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0mtimer\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0mglobals\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0mtimeit\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0mnumber\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0m\u001b[1;32m    234\u001b[0m \u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m    235\u001b[0m def repeat(stmt=\"pass\", setup=\"pass\", timer=default_timer,\n",
      "\u001b[0;32m/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/timeit.py\u001b[0m in \u001b[0;36m__init__\u001b[0;34m(self, stmt, setup, timer, globals)\u001b[0m\n\u001b[1;32m    128\u001b[0m             \u001b[0mstmt\u001b[0m \u001b[0;34m=\u001b[0m \u001b[0;34m'_stmt()'\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m    129\u001b[0m         \u001b[0;32melse\u001b[0m\u001b[0;34m:\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0;32m--> 130\u001b[0;31m             \u001b[0;32mraise\u001b[0m \u001b[0mValueError\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0;34m\"stmt is neither a string nor callable\"\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0m\u001b[1;32m    131\u001b[0m         \u001b[0msrc\u001b[0m \u001b[0;34m=\u001b[0m \u001b[0mtemplate\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0mformat\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0mstmt\u001b[0m\u001b[0;34m=\u001b[0m\u001b[0mstmt\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0msetup\u001b[0m\u001b[0;34m=\u001b[0m\u001b[0msetup\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0minit\u001b[0m\u001b[0;34m=\u001b[0m\u001b[0minit\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m    132\u001b[0m         \u001b[0mself\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0msrc\u001b[0m \u001b[0;34m=\u001b[0m \u001b[0msrc\u001b[0m  \u001b[0;31m# Save for traceback display\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n",
      "\u001b[0;31mValueError\u001b[0m: stmt is neither a string nor callable"
     ]
    }
   ],
   "source": [
    "timeit.timeit(,number=1000)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 7,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "[0,\n",
       " 2,\n",
       " 4,\n",
       " 6,\n",
       " 8,\n",
       " 10,\n",
       " 12,\n",
       " 14,\n",
       " 16,\n",
       " 18,\n",
       " 20,\n",
       " 22,\n",
       " 24,\n",
       " 26,\n",
       " 28,\n",
       " 30,\n",
       " 32,\n",
       " 34,\n",
       " 36,\n",
       " 38,\n",
       " 40,\n",
       " 42,\n",
       " 44,\n",
       " 46,\n",
       " 48,\n",
       " 50,\n",
       " 52,\n",
       " 54,\n",
       " 56,\n",
       " 58,\n",
       " 60,\n",
       " 62,\n",
       " 64,\n",
       " 66,\n",
       " 68,\n",
       " 70,\n",
       " 72,\n",
       " 74,\n",
       " 76,\n",
       " 78,\n",
       " 80,\n",
       " 82,\n",
       " 84,\n",
       " 86,\n",
       " 88,\n",
       " 90,\n",
       " 92,\n",
       " 94,\n",
       " 96,\n",
       " 98,\n",
       " 100,\n",
       " 102,\n",
       " 104,\n",
       " 106,\n",
       " 108,\n",
       " 110,\n",
       " 112,\n",
       " 114,\n",
       " 116,\n",
       " 118,\n",
       " 120,\n",
       " 122,\n",
       " 124,\n",
       " 126,\n",
       " 128,\n",
       " 130,\n",
       " 132,\n",
       " 134,\n",
       " 136,\n",
       " 138,\n",
       " 140,\n",
       " 142,\n",
       " 144,\n",
       " 146,\n",
       " 148,\n",
       " 150,\n",
       " 152,\n",
       " 154,\n",
       " 156,\n",
       " 158,\n",
       " 160,\n",
       " 162,\n",
       " 164,\n",
       " 166,\n",
       " 168,\n",
       " 170,\n",
       " 172,\n",
       " 174,\n",
       " 176,\n",
       " 178,\n",
       " 180,\n",
       " 182,\n",
       " 184,\n",
       " 186,\n",
       " 188,\n",
       " 190,\n",
       " 192,\n",
       " 194,\n",
       " 196,\n",
       " 198,\n",
       " 200,\n",
       " 202,\n",
       " 204,\n",
       " 206,\n",
       " 208,\n",
       " 210,\n",
       " 212,\n",
       " 214,\n",
       " 216,\n",
       " 218,\n",
       " 220,\n",
       " 222,\n",
       " 224,\n",
       " 226,\n",
       " 228,\n",
       " 230,\n",
       " 232,\n",
       " 234,\n",
       " 236,\n",
       " 238,\n",
       " 240,\n",
       " 242,\n",
       " 244,\n",
       " 246,\n",
       " 248,\n",
       " 250,\n",
       " 252,\n",
       " 254,\n",
       " 256,\n",
       " 258,\n",
       " 260,\n",
       " 262,\n",
       " 264,\n",
       " 266,\n",
       " 268,\n",
       " 270,\n",
       " 272,\n",
       " 274,\n",
       " 276,\n",
       " 278,\n",
       " 280,\n",
       " 282,\n",
       " 284,\n",
       " 286,\n",
       " 288,\n",
       " 290,\n",
       " 292,\n",
       " 294,\n",
       " 296,\n",
       " 298,\n",
       " 300,\n",
       " 302,\n",
       " 304,\n",
       " 306,\n",
       " 308,\n",
       " 310,\n",
       " 312,\n",
       " 314,\n",
       " 316,\n",
       " 318,\n",
       " 320,\n",
       " 322,\n",
       " 324,\n",
       " 326,\n",
       " 328,\n",
       " 330,\n",
       " 332,\n",
       " 334,\n",
       " 336,\n",
       " 338,\n",
       " 340,\n",
       " 342,\n",
       " 344,\n",
       " 346,\n",
       " 348,\n",
       " 350,\n",
       " 352,\n",
       " 354,\n",
       " 356,\n",
       " 358,\n",
       " 360,\n",
       " 362,\n",
       " 364,\n",
       " 366,\n",
       " 368,\n",
       " 370,\n",
       " 372,\n",
       " 374,\n",
       " 376,\n",
       " 378,\n",
       " 380,\n",
       " 382,\n",
       " 384,\n",
       " 386,\n",
       " 388,\n",
       " 390,\n",
       " 392,\n",
       " 394,\n",
       " 396,\n",
       " 398,\n",
       " 400,\n",
       " 402,\n",
       " 404,\n",
       " 406,\n",
       " 408,\n",
       " 410,\n",
       " 412,\n",
       " 414,\n",
       " 416,\n",
       " 418,\n",
       " 420,\n",
       " 422,\n",
       " 424,\n",
       " 426,\n",
       " 428,\n",
       " 430,\n",
       " 432,\n",
       " 434,\n",
       " 436,\n",
       " 438,\n",
       " 440,\n",
       " 442,\n",
       " 444,\n",
       " 446,\n",
       " 448,\n",
       " 450,\n",
       " 452,\n",
       " 454,\n",
       " 456,\n",
       " 458,\n",
       " 460,\n",
       " 462,\n",
       " 464,\n",
       " 466,\n",
       " 468,\n",
       " 470,\n",
       " 472,\n",
       " 474,\n",
       " 476,\n",
       " 478,\n",
       " 480,\n",
       " 482,\n",
       " 484,\n",
       " 486,\n",
       " 488,\n",
       " 490,\n",
       " 492,\n",
       " 494,\n",
       " 496,\n",
       " 498,\n",
       " 500,\n",
       " 502,\n",
       " 504,\n",
       " 506,\n",
       " 508,\n",
       " 510,\n",
       " 512,\n",
       " 514,\n",
       " 516,\n",
       " 518,\n",
       " 520,\n",
       " 522,\n",
       " 524,\n",
       " 526,\n",
       " 528,\n",
       " 530,\n",
       " 532,\n",
       " 534,\n",
       " 536,\n",
       " 538,\n",
       " 540,\n",
       " 542,\n",
       " 544,\n",
       " 546,\n",
       " 548,\n",
       " 550,\n",
       " 552,\n",
       " 554,\n",
       " 556,\n",
       " 558,\n",
       " 560,\n",
       " 562,\n",
       " 564,\n",
       " 566,\n",
       " 568,\n",
       " 570,\n",
       " 572,\n",
       " 574,\n",
       " 576,\n",
       " 578,\n",
       " 580,\n",
       " 582,\n",
       " 584,\n",
       " 586,\n",
       " 588,\n",
       " 590,\n",
       " 592,\n",
       " 594,\n",
       " 596,\n",
       " 598,\n",
       " 600,\n",
       " 602,\n",
       " 604,\n",
       " 606,\n",
       " 608,\n",
       " 610,\n",
       " 612,\n",
       " 614,\n",
       " 616,\n",
       " 618,\n",
       " 620,\n",
       " 622,\n",
       " 624,\n",
       " 626,\n",
       " 628,\n",
       " 630,\n",
       " 632,\n",
       " 634,\n",
       " 636,\n",
       " 638,\n",
       " 640,\n",
       " 642,\n",
       " 644,\n",
       " 646,\n",
       " 648,\n",
       " 650,\n",
       " 652,\n",
       " 654,\n",
       " 656,\n",
       " 658,\n",
       " 660,\n",
       " 662,\n",
       " 664,\n",
       " 666,\n",
       " 668,\n",
       " 670,\n",
       " 672,\n",
       " 674,\n",
       " 676,\n",
       " 678,\n",
       " 680,\n",
       " 682,\n",
       " 684,\n",
       " 686,\n",
       " 688,\n",
       " 690,\n",
       " 692,\n",
       " 694,\n",
       " 696,\n",
       " 698,\n",
       " 700,\n",
       " 702,\n",
       " 704,\n",
       " 706,\n",
       " 708,\n",
       " 710,\n",
       " 712,\n",
       " 714,\n",
       " 716,\n",
       " 718,\n",
       " 720,\n",
       " 722,\n",
       " 724,\n",
       " 726,\n",
       " 728,\n",
       " 730,\n",
       " 732,\n",
       " 734,\n",
       " 736,\n",
       " 738,\n",
       " 740,\n",
       " 742,\n",
       " 744,\n",
       " 746,\n",
       " 748,\n",
       " 750,\n",
       " 752,\n",
       " 754,\n",
       " 756,\n",
       " 758,\n",
       " 760,\n",
       " 762,\n",
       " 764,\n",
       " 766,\n",
       " 768,\n",
       " 770,\n",
       " 772,\n",
       " 774,\n",
       " 776,\n",
       " 778,\n",
       " 780,\n",
       " 782,\n",
       " 784,\n",
       " 786,\n",
       " 788,\n",
       " 790,\n",
       " 792,\n",
       " 794,\n",
       " 796,\n",
       " 798,\n",
       " 800,\n",
       " 802,\n",
       " 804,\n",
       " 806,\n",
       " 808,\n",
       " 810,\n",
       " 812,\n",
       " 814,\n",
       " 816,\n",
       " 818,\n",
       " 820,\n",
       " 822,\n",
       " 824,\n",
       " 826,\n",
       " 828,\n",
       " 830,\n",
       " 832,\n",
       " 834,\n",
       " 836,\n",
       " 838,\n",
       " 840,\n",
       " 842,\n",
       " 844,\n",
       " 846,\n",
       " 848,\n",
       " 850,\n",
       " 852,\n",
       " 854,\n",
       " 856,\n",
       " 858,\n",
       " 860,\n",
       " 862,\n",
       " 864,\n",
       " 866,\n",
       " 868,\n",
       " 870,\n",
       " 872,\n",
       " 874,\n",
       " 876,\n",
       " 878,\n",
       " 880,\n",
       " 882,\n",
       " 884,\n",
       " 886,\n",
       " 888,\n",
       " 890,\n",
       " 892,\n",
       " 894,\n",
       " 896,\n",
       " 898,\n",
       " 900,\n",
       " 902,\n",
       " 904,\n",
       " 906,\n",
       " 908,\n",
       " 910,\n",
       " 912,\n",
       " 914,\n",
       " 916,\n",
       " 918,\n",
       " 920,\n",
       " 922,\n",
       " 924,\n",
       " 926,\n",
       " 928,\n",
       " 930,\n",
       " 932,\n",
       " 934,\n",
       " 936,\n",
       " 938,\n",
       " 940,\n",
       " 942,\n",
       " 944,\n",
       " 946,\n",
       " 948,\n",
       " 950,\n",
       " 952,\n",
       " 954,\n",
       " 956,\n",
       " 958,\n",
       " 960,\n",
       " 962,\n",
       " 964,\n",
       " 966,\n",
       " 968,\n",
       " 970,\n",
       " 972,\n",
       " 974,\n",
       " 976,\n",
       " 978,\n",
       " 980,\n",
       " 982,\n",
       " 984,\n",
       " 986,\n",
       " 988,\n",
       " 990,\n",
       " 992,\n",
       " 994,\n",
       " 996,\n",
       " 998,\n",
       " 1000,\n",
       " 1002,\n",
       " 1004,\n",
       " 1006,\n",
       " 1008,\n",
       " 1010,\n",
       " 1012,\n",
       " 1014,\n",
       " 1016,\n",
       " 1018,\n",
       " 1020,\n",
       " 1022,\n",
       " 1024,\n",
       " 1026,\n",
       " 1028,\n",
       " 1030,\n",
       " 1032,\n",
       " 1034,\n",
       " 1036,\n",
       " 1038,\n",
       " 1040,\n",
       " 1042,\n",
       " 1044,\n",
       " 1046,\n",
       " 1048,\n",
       " 1050,\n",
       " 1052,\n",
       " 1054,\n",
       " 1056,\n",
       " 1058,\n",
       " 1060,\n",
       " 1062,\n",
       " 1064,\n",
       " 1066,\n",
       " 1068,\n",
       " 1070,\n",
       " 1072,\n",
       " 1074,\n",
       " 1076,\n",
       " 1078,\n",
       " 1080,\n",
       " 1082,\n",
       " 1084,\n",
       " 1086,\n",
       " 1088,\n",
       " 1090,\n",
       " 1092,\n",
       " 1094,\n",
       " 1096,\n",
       " 1098,\n",
       " 1100,\n",
       " 1102,\n",
       " 1104,\n",
       " 1106,\n",
       " 1108,\n",
       " 1110,\n",
       " 1112,\n",
       " 1114,\n",
       " 1116,\n",
       " 1118,\n",
       " 1120,\n",
       " 1122,\n",
       " 1124,\n",
       " 1126,\n",
       " 1128,\n",
       " 1130,\n",
       " 1132,\n",
       " 1134,\n",
       " 1136,\n",
       " 1138,\n",
       " 1140,\n",
       " 1142,\n",
       " 1144,\n",
       " 1146,\n",
       " 1148,\n",
       " 1150,\n",
       " 1152,\n",
       " 1154,\n",
       " 1156,\n",
       " 1158,\n",
       " 1160,\n",
       " 1162,\n",
       " 1164,\n",
       " 1166,\n",
       " 1168,\n",
       " 1170,\n",
       " 1172,\n",
       " 1174,\n",
       " 1176,\n",
       " 1178,\n",
       " 1180,\n",
       " 1182,\n",
       " 1184,\n",
       " 1186,\n",
       " 1188,\n",
       " 1190,\n",
       " 1192,\n",
       " 1194,\n",
       " 1196,\n",
       " 1198,\n",
       " 1200,\n",
       " 1202,\n",
       " 1204,\n",
       " 1206,\n",
       " 1208,\n",
       " 1210,\n",
       " 1212,\n",
       " 1214,\n",
       " 1216,\n",
       " 1218,\n",
       " 1220,\n",
       " 1222,\n",
       " 1224,\n",
       " 1226,\n",
       " 1228,\n",
       " 1230,\n",
       " 1232,\n",
       " 1234,\n",
       " 1236,\n",
       " 1238,\n",
       " 1240,\n",
       " 1242,\n",
       " 1244,\n",
       " 1246,\n",
       " 1248,\n",
       " 1250,\n",
       " 1252,\n",
       " 1254,\n",
       " 1256,\n",
       " 1258,\n",
       " 1260,\n",
       " 1262,\n",
       " 1264,\n",
       " 1266,\n",
       " 1268,\n",
       " 1270,\n",
       " 1272,\n",
       " 1274,\n",
       " 1276,\n",
       " 1278,\n",
       " 1280,\n",
       " 1282,\n",
       " 1284,\n",
       " 1286,\n",
       " 1288,\n",
       " 1290,\n",
       " 1292,\n",
       " 1294,\n",
       " 1296,\n",
       " 1298,\n",
       " 1300,\n",
       " 1302,\n",
       " 1304,\n",
       " 1306,\n",
       " 1308,\n",
       " 1310,\n",
       " 1312,\n",
       " 1314,\n",
       " 1316,\n",
       " 1318,\n",
       " 1320,\n",
       " 1322,\n",
       " 1324,\n",
       " 1326,\n",
       " 1328,\n",
       " 1330,\n",
       " 1332,\n",
       " 1334,\n",
       " 1336,\n",
       " 1338,\n",
       " 1340,\n",
       " 1342,\n",
       " 1344,\n",
       " 1346,\n",
       " 1348,\n",
       " 1350,\n",
       " 1352,\n",
       " 1354,\n",
       " 1356,\n",
       " 1358,\n",
       " 1360,\n",
       " 1362,\n",
       " 1364,\n",
       " 1366,\n",
       " 1368,\n",
       " 1370,\n",
       " 1372,\n",
       " 1374,\n",
       " 1376,\n",
       " 1378,\n",
       " 1380,\n",
       " 1382,\n",
       " 1384,\n",
       " 1386,\n",
       " 1388,\n",
       " 1390,\n",
       " 1392,\n",
       " 1394,\n",
       " 1396,\n",
       " 1398,\n",
       " 1400,\n",
       " 1402,\n",
       " 1404,\n",
       " 1406,\n",
       " 1408,\n",
       " 1410,\n",
       " 1412,\n",
       " 1414,\n",
       " 1416,\n",
       " 1418,\n",
       " 1420,\n",
       " 1422,\n",
       " 1424,\n",
       " 1426,\n",
       " 1428,\n",
       " 1430,\n",
       " 1432,\n",
       " 1434,\n",
       " 1436,\n",
       " 1438,\n",
       " 1440,\n",
       " 1442,\n",
       " 1444,\n",
       " 1446,\n",
       " 1448,\n",
       " 1450,\n",
       " 1452,\n",
       " 1454,\n",
       " 1456,\n",
       " 1458,\n",
       " 1460,\n",
       " 1462,\n",
       " 1464,\n",
       " 1466,\n",
       " 1468,\n",
       " 1470,\n",
       " 1472,\n",
       " 1474,\n",
       " 1476,\n",
       " 1478,\n",
       " 1480,\n",
       " 1482,\n",
       " 1484,\n",
       " 1486,\n",
       " 1488,\n",
       " 1490,\n",
       " 1492,\n",
       " 1494,\n",
       " 1496,\n",
       " 1498,\n",
       " 1500,\n",
       " 1502,\n",
       " 1504,\n",
       " 1506,\n",
       " 1508,\n",
       " 1510,\n",
       " 1512,\n",
       " 1514,\n",
       " 1516,\n",
       " 1518,\n",
       " 1520,\n",
       " 1522,\n",
       " 1524,\n",
       " 1526,\n",
       " 1528,\n",
       " 1530,\n",
       " 1532,\n",
       " 1534,\n",
       " 1536,\n",
       " 1538,\n",
       " 1540,\n",
       " 1542,\n",
       " 1544,\n",
       " 1546,\n",
       " 1548,\n",
       " 1550,\n",
       " 1552,\n",
       " 1554,\n",
       " 1556,\n",
       " 1558,\n",
       " 1560,\n",
       " 1562,\n",
       " 1564,\n",
       " 1566,\n",
       " 1568,\n",
       " 1570,\n",
       " 1572,\n",
       " 1574,\n",
       " 1576,\n",
       " 1578,\n",
       " 1580,\n",
       " 1582,\n",
       " 1584,\n",
       " 1586,\n",
       " 1588,\n",
       " 1590,\n",
       " 1592,\n",
       " 1594,\n",
       " 1596,\n",
       " 1598,\n",
       " 1600,\n",
       " 1602,\n",
       " 1604,\n",
       " 1606,\n",
       " 1608,\n",
       " 1610,\n",
       " 1612,\n",
       " 1614,\n",
       " 1616,\n",
       " 1618,\n",
       " 1620,\n",
       " 1622,\n",
       " 1624,\n",
       " 1626,\n",
       " 1628,\n",
       " 1630,\n",
       " 1632,\n",
       " 1634,\n",
       " 1636,\n",
       " 1638,\n",
       " 1640,\n",
       " 1642,\n",
       " 1644,\n",
       " 1646,\n",
       " 1648,\n",
       " 1650,\n",
       " 1652,\n",
       " 1654,\n",
       " 1656,\n",
       " 1658,\n",
       " 1660,\n",
       " 1662,\n",
       " 1664,\n",
       " 1666,\n",
       " 1668,\n",
       " 1670,\n",
       " 1672,\n",
       " 1674,\n",
       " 1676,\n",
       " 1678,\n",
       " 1680,\n",
       " 1682,\n",
       " 1684,\n",
       " 1686,\n",
       " 1688,\n",
       " 1690,\n",
       " 1692,\n",
       " 1694,\n",
       " 1696,\n",
       " 1698,\n",
       " 1700,\n",
       " 1702,\n",
       " 1704,\n",
       " 1706,\n",
       " 1708,\n",
       " 1710,\n",
       " 1712,\n",
       " 1714,\n",
       " 1716,\n",
       " 1718,\n",
       " 1720,\n",
       " 1722,\n",
       " 1724,\n",
       " 1726,\n",
       " 1728,\n",
       " 1730,\n",
       " 1732,\n",
       " 1734,\n",
       " 1736,\n",
       " 1738,\n",
       " 1740,\n",
       " 1742,\n",
       " 1744,\n",
       " 1746,\n",
       " 1748,\n",
       " 1750,\n",
       " 1752,\n",
       " 1754,\n",
       " 1756,\n",
       " 1758,\n",
       " 1760,\n",
       " 1762,\n",
       " 1764,\n",
       " 1766,\n",
       " 1768,\n",
       " 1770,\n",
       " 1772,\n",
       " 1774,\n",
       " 1776,\n",
       " 1778,\n",
       " 1780,\n",
       " 1782,\n",
       " 1784,\n",
       " 1786,\n",
       " 1788,\n",
       " 1790,\n",
       " 1792,\n",
       " 1794,\n",
       " 1796,\n",
       " 1798,\n",
       " 1800,\n",
       " 1802,\n",
       " 1804,\n",
       " 1806,\n",
       " 1808,\n",
       " 1810,\n",
       " 1812,\n",
       " 1814,\n",
       " 1816,\n",
       " 1818,\n",
       " 1820,\n",
       " 1822,\n",
       " 1824,\n",
       " 1826,\n",
       " 1828,\n",
       " 1830,\n",
       " 1832,\n",
       " 1834,\n",
       " 1836,\n",
       " 1838,\n",
       " 1840,\n",
       " 1842,\n",
       " 1844,\n",
       " 1846,\n",
       " 1848,\n",
       " 1850,\n",
       " 1852,\n",
       " 1854,\n",
       " 1856,\n",
       " 1858,\n",
       " 1860,\n",
       " 1862,\n",
       " 1864,\n",
       " 1866,\n",
       " 1868,\n",
       " 1870,\n",
       " 1872,\n",
       " 1874,\n",
       " 1876,\n",
       " 1878,\n",
       " 1880,\n",
       " 1882,\n",
       " 1884,\n",
       " 1886,\n",
       " 1888,\n",
       " 1890,\n",
       " 1892,\n",
       " 1894,\n",
       " 1896,\n",
       " 1898,\n",
       " 1900,\n",
       " 1902,\n",
       " 1904,\n",
       " 1906,\n",
       " 1908,\n",
       " 1910,\n",
       " 1912,\n",
       " 1914,\n",
       " 1916,\n",
       " 1918,\n",
       " 1920,\n",
       " 1922,\n",
       " 1924,\n",
       " 1926,\n",
       " 1928,\n",
       " 1930,\n",
       " 1932,\n",
       " 1934,\n",
       " 1936,\n",
       " 1938,\n",
       " 1940,\n",
       " 1942,\n",
       " 1944,\n",
       " 1946,\n",
       " 1948,\n",
       " 1950,\n",
       " 1952,\n",
       " 1954,\n",
       " 1956,\n",
       " 1958,\n",
       " 1960,\n",
       " 1962,\n",
       " 1964,\n",
       " 1966,\n",
       " 1968,\n",
       " 1970,\n",
       " 1972,\n",
       " 1974,\n",
       " 1976,\n",
       " 1978,\n",
       " 1980,\n",
       " 1982,\n",
       " 1984,\n",
       " 1986,\n",
       " 1988,\n",
       " 1990,\n",
       " 1992,\n",
       " 1994,\n",
       " 1996,\n",
       " 1998]"
      ]
     },
     "execution_count": 7,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "import timeit\n",
    "[2 * n for n in range(1000)]"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": []
  }
 ],
 "metadata": {
  "kernelspec": {
   "display_name": "Python 3",
   "language": "python",
   "name": "python3"
  },
  "language_info": {
   "codemirror_mode": {
    "name": "ipython",
    "version": 3
   },
   "file_extension": ".py",
   "mimetype": "text/x-python",
   "name": "python",
   "nbconvert_exporter": "python",
   "pygments_lexer": "ipython3",
   "version": "3.6.3"
  }
 },
 "nbformat": 4,
 "nbformat_minor": 2
}
